/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package desu.nya.animepersistance.model;

import desu.nya.animepersistance.utils.AnimeFactory;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author ievstratov
 */
public class GenreMask {
    private static List<Genre> GENRE_LIST = AnimeFactory.getGenreBo().getListId();
    public static List<Genre> getGenreByMask(long mask)
    {
        List<Genre> list = new ArrayList<Genre>();
        for(Genre genre:GENRE_LIST){
            if((mask&genre.getId()) == genre.getId()) {
                list.add(genre);
            }
        }
        return list;
    }
    
    public static long getMaskByGenre(List<Genre> list)
    {
        long mask = 0;
        for(Genre genre: list)
        {
            mask|=genre.getId();
            
        }
        return mask;
    }
}
